package com.xiaoshuidi.cloud.module.iot;

import com.alibaba.fastjson.JSON;
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
import com.hikvision.artemis.sdk.config.ArtemisConfig;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author Feng
 * @date 2023/6/25
 */
public class TestArtemis {

    public static void main(String[] args) {
        try {
            test();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    private static final String ARTEMIS_PATH = "/artemis";

    public static void test() throws Exception {
        ArtemisConfig config = new ArtemisConfig();
        config.setAppKey("24694047");
        config.setAppSecret("VMo4KQIW23PqkVLGWM5I");
        config.setHost("111.39.230.51:1443");
        final String getCamsApi = ARTEMIS_PATH + "/api/irds/v2/deviceResource/resources";
        Map<String, String> paramMap = new HashMap<String, String>();// post请求Form表单参数
        paramMap.put("pageNo", "1");
        paramMap.put("pageSize", "2");
        paramMap.put("resourceType", "door");
        String body = JSON.toJSON(paramMap).toString();
        Map<String, String> path = new HashMap<String, String>(2) {
            {
                put("https://", getCamsApi);
            }
        };
        String s = ArtemisHttpUtil.doPostStringArtemis(config, path, body, null, null, "application/json");
        System.out.println(s);
    }
}
